package nc.vo.jx.pub;

import nc.ui.pub.bill.BillListPanel;

public class ListPanelPRTS extends nc.ui.trade.pub.ListPanelPRTS {
	BillListPanel m_listpanel;
	int row = -1;
	
	public int getRow() {
		return row;
	}

	public void setRow(int row) {
		this.row = row;
	}

	public ListPanelPRTS(String modulecode, BillListPanel bp) {
		super(modulecode, bp);
		m_listpanel=bp;
	}
	public ListPanelPRTS(String modulecode, BillListPanel bp,int row) {
		super(modulecode, bp);
		m_listpanel=bp;
		this.row = row;
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = -8306397218862970770L;

	@Override
	public String[] getItemValuesByExpress(String itemExpress) {
		int row=getRow();
		if(itemExpress.startsWith("h_")){
			Object obj=m_listpanel.getHeadBillModel().getValueAt(row,itemExpress.substring(2));
			if(obj!=null)
				return new String[]{obj.toString()};
		}
		else if(itemExpress.startsWith("t_")){
			Object obj=m_listpanel.getHeadBillModel().getValueAt(row,itemExpress.substring(2));
			if(obj!=null)
				return new String[]{obj.toString()};
		}
		else{
			int rowCount=m_listpanel.getBodyBillModel().getRowCount();
			String[] retStr=new String[rowCount];
			for(int i=0;i<rowCount;i++){
				Object obj=m_listpanel.getBodyBillModel().getValueAt(i,itemExpress);
				if(obj!=null)
					retStr[i]=obj.toString();
				else
					retStr[i]="";
			}
			return retStr;
		}
		return null;
	}
}
